$j(function() {
    $j(window).scroll(function(){
        tableHeader();
    })

    $j(window).resize(function(){
        widthSet();
    })
    widthSet();
})

function tableHeader(e){
    var needHeight = $j('.shop-table').offset().top;
    var headerHeight = $j('.shop-admin-menu').height();
    if($j(window).scrollTop() >  needHeight - headerHeight ){
        $j('.shop-table thead').addClass('fix-t').css({
            'margin-top':  - needHeight + headerHeight +'px'
        });
    }else{
        $j('.shop-table thead').removeClass('fix-t'); 
    }
}

function widthSet(){
    $j('.shop-table tbody tr:first-child td, .shop-table thead  td').each(function(){
        $j(this).attr({
            width : $j(this).width()
        })
    })
}